#include <iostream>
#include <cstring>
using namespace std;

class Hotel
{
private:
    static int totalCustNum;   // 顾客总人数
    static float totalEarning; // 旅店总收入
    static float rent;         // 每个顾客的房租
    char *customerName;        // 顾客姓名
    int customerId;            // 顾客编号
public:
    // totalCustNum++，customerId按照totalCustNum生成
    Hotel() { customerName = NULL; }
    Hotel(char *customer, float rent);
    ~Hotel(){};     //记得delete customerName
    void Display(); //相应输出顾客姓名、顾客编号、总人数、总收入
};

float Hotel::totalEarning = 0;
int Hotel::totalCustNum = 0;
float Hotel::rent = 0;

Hotel::Hotel(char *customer, float rent)
{
    customerName = new char[strlen(customer) + 1];
    strcpy(customerName, customer);
    this->rent = rent;
    totalCustNum++;
    customerId = 20150000 + totalCustNum;
    totalEarning += rent;
}

void Hotel::Display()
{
    // cout<<"1";
    cout << customerName << " " << customerId << " " << totalCustNum << " " << totalEarning << endl;
}

int main()
{
    float rent;
    cin >> rent;
    while (1)
    {
        char name[20];
        cin >> name;
        if (*name == '0')
        {
            break;
        }
        Hotel a(name, rent);
        a.Display();
    }

    return 0;
}